﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using SimpleCalculator;

namespace Simple_Calculator_Testing
{
    
    
    /// <summary>
    ///This is a test class for CalcTest and is intended
    ///to contain all CalcTest Unit Tests
    ///</summary>
    [TestClass]
    public class CalcTest
    {


        private TestContext _testContextInstance;

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion



        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        public void TestAddNormal()
        {
            var target = new Calc();
            const char operation = '+';
            const int operand1 = -5;
            const int operand2 = 5;
            const int expected = 0;
            var actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual((long?) 0, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }


        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        public void TestSubNormal()
        {
            var target = new Calc(); // TODO: Initialize to an appropriate value
            var operation = '-'; // TODO: Initialize to an appropriate value
            var operand1 = -1; // TODO: Initialize to an appropriate value
            var operand2 = -1; // TODO: Initialize to an appropriate value
            var expected = 0; // TODO: Initialize to an appropriate value
            byte actual;
            actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual((long?)0, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        public void TestDivNormal()
        {
            var target = new Calc(); // TODO: Initialize to an appropriate value
            var operation = '/'; // TODO: Initialize to an appropriate value
            var operand1 = 25; // TODO: Initialize to an appropriate value
            var operand2 = 5; // TODO: Initialize to an appropriate value
            var expected = 0; // TODO: Initialize to an appropriate value
            byte actual;
            actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual((long?)5, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        public void TestMulNormal()
        {
            var target = new Calc(); // TODO: Initialize to an appropriate value
            var operation = '*'; // TODO: Initialize to an appropriate value
            var operand1 = 100; // TODO: Initialize to an appropriate value
            var operand2 = 23; // TODO: Initialize to an appropriate value
            var expected = 0; // TODO: Initialize to an appropriate value
            byte actual;
            actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual((long?)2300, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        public void TestAddMaximum()
        {
            var target = new Calc(); // TODO: Initialize to an appropriate value
            var operation = '+'; // TODO: Initialize to an appropriate value
            var operand1 = 2147483647; // TODO: Initialize to an appropriate value
            var operand2 = 2147483647; // TODO: Initialize to an appropriate value
            var expected = 0; // TODO: Initialize to an appropriate value
            byte actual;
            actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual((long?)4294967294, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        public void TestSubMaximum()
        {
            var target = new Calc(); // TODO: Initialize to an appropriate value
            var operation = '-'; // TODO: Initialize to an appropriate value
            var operand1 = -2147483648; // TODO: Initialize to an appropriate value
            var operand2 = 2147483647; // TODO: Initialize to an appropriate value
            var expected = 0; // TODO: Initialize to an appropriate value
            byte actual;
            actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual((long?)-4294967295, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        //[ExpectedException(typeof(System.DivideByZeroException))]
        public void TestDivZero()
        {
            var target = new Calc(); // TODO: Initialize to an appropriate value
            var operation = '/'; // TODO: Initialize to an appropriate value
            var operand1 = 100; // TODO: Initialize to an appropriate value
            var operand2 = 0; // TODO: Initialize to an appropriate value
            var expected = 1; // TODO: Initialize to an appropriate value
            byte actual;
            actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(null, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ProcessCalculations
        ///</summary>
        [TestMethod()]
        public void TestUnknownOperation()
        {
            var target = new Calc(); // TODO: Initialize to an appropriate value
            var operation = '='; // TODO: Initialize to an appropriate value
            var operand1 = 0; // TODO: Initialize to an appropriate value
            var operand2 = 0; // TODO: Initialize to an appropriate value
            var expected = 2; // TODO: Initialize to an appropriate value
            byte actual;
            actual = target.ProcessCalculations(operation, operand1, operand2);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(null, target.Result);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
